package com.loooooo.pm2024.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;

public class Base64Utils {

    public static String encodeToString(InputStream inputStream) {
        try {
            byte[] buff = new byte[inputStream.available()];
            inputStream.read(buff);
            return Base64.getEncoder().encodeToString(buff);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String encodeToString(byte[] buff) {
        return Base64.getEncoder().encodeToString(buff);
    }
}
